﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System.Net;
using System.Security.Claims;
using TMS_BackEnd.Filters;
using TMS_BackEnd.Models.He;

namespace TMS_BackEnd.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ServiceFilter(typeof(HelperFilter))]
    [Authorize]
    public class HelpController : ControllerBase
    {

        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public ActionResult Helper()
        {
            string? userName = this.User.FindFirst(ClaimTypes.Name).Value;
            IEnumerable<Claim> roleClaims = this.User.FindAll(ClaimTypes.Role);
            string roleNames = string.Join(',', roleClaims.Select(c => c.Value));
            return Ok(new
            {
                code = 1,
                message = "验证成功"
            });
        }

    }
}
